```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Gradle高级技巧指南</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        :root {
            --primary: #4361ee;
            --secondary: #3f37c9;
            --accent: #4895ef;
            --dark: #1a1a2e;
            --light: #f8f9fa;
        }
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: var(--dark);
            line-height: 1.8;
        }
        .hero-gradient {
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
        }
        .code-block {
            background: #2d3748;
            border-left: 4px solid var(--accent);
        }
        .hover-scale {
            transition: transform 0.3s ease;
        }
        .hover-scale:hover {
            transform: translateY(-5px);
        }
        .section-divider {
            height: 2px;
            background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <header class="hero-gradient text-white py-20 px-6">
        <div class="max-w-6xl mx-auto text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6">Gradle高级技巧指南</h1>
            <p class="text-xl md:text-2xl opacity-90 mb-8">掌握构建工具的核心技术与最佳实践</p>
            <div class="flex justify-center space-x-4">
                <div class="bg-white text-blue-600 px-6 py-3 rounded-lg font-medium shadow-md hover:shadow-lg transition-shadow">
                    <i class="fas fa-book-open mr-2"></i>开始学习
                </div>
                <div class="border-2 border-white text-white px-6 py-3 rounded-lg font-medium hover:bg-white hover:text-blue-600 transition-colors">
                    <i class="fas fa-code mr-2"></i>代码示例
                </div>
            </div>
        </div>
    </header>

    <!-- Main Content -->
    <main class="max-w-6xl mx-auto px-6 py-12">
        <!-- Dependency Management Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="bg-blue-100 text-blue-600 rounded-full w-12 h-12 flex items-center justify-center mr-4">
                    <i class="fas fa-cubes text-2xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">1. 依赖管理深入</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale">
                    <div class="bg-blue-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold">依赖类型详解</h3>
                    </div>
                    <div class="p-6">
                        <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>dependencies {
    implementation 'org.apache.commons:commons-lang3:3.12.0' // 编译+运行时
    compileOnly 'javax.servlet:servlet-api:4.0.1'         // 仅编译
    runtimeOnly 'mysql:mysql-connector-java:8.0.28'       // 仅运行时
    testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2' // 测试
    annotationProcessor 'org.projectlombok:lombok:1.18.24' // 注解处理
}</code></pre>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale">
                    <div class="bg-blue-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold">依赖配置策略</h3>
                    </div>
                    <div class="p-6">
                        <ul class="space-y-3">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>使用<code class="bg-gray-100 px-2 py-1 rounded">implementation</code>代替<code class="bg-gray-100 px-2 py-1 rounded">compile</code>避免泄露依赖</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span><code class="bg-gray-100 px-2 py-1 rounded">api</code>用于需要传递的依赖（库开发场景）</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>使用<code class="bg-gray-100 px-2 py-1 rounded">platform()</code>管理BOM依赖</span>
                            </li>
                        </ul>
                        <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto mt-4"><code>implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.0')</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale mb-8">
                <div class="bg-blue-600 text-white px-6 py-4">
                    <h3 class="text-xl font-semibold">依赖冲突解决</h3>
                </div>
                <div class="p-6">
                    <div class="grid md:grid-cols-3 gap-4">
                        <div>
                            <h4 class="font-medium text-gray-700 mb-2">强制版本</h4>
                            <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto text-sm"><code>configurations.all {
    resolutionStrategy.force 
    'com.google.guava:guava:31.1-jre'
}</code></pre>
                        </div>
                        <div>
                            <h4 class="font-medium text-gray-700 mb-2">排除依赖</h4>
                            <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto text-sm"><code>implementation ('org.apache.hive:hive-exec:3.1.2') {
    exclude group: 'org.apache.logging.log4j', 
            module: 'log4j-core'
}</code></pre>
                        </div>
                        <div>
                            <h4 class="font-medium text-gray-700 mb-2">依赖锁定</h4>
                            <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto text-sm"><code>dependencyLocking {
    lockAllConfigurations()
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="section-divider my-12"></div>
        </section>

        <!-- Task Development Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="bg-purple-100 text-purple-600 rounded-full w-12 h-12 flex items-center justify-center mr-4">
                    <i class="fas fa-tasks text-2xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">2. 自定义Task开发</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale">
                    <div class="bg-purple-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold">创建文件处理Task</h3>
                    </div>
                    <div class="p-6">
                        <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>tasks.register('processFiles', Copy) {
    from 'src/raw'
    into 'build/processed'
    include '*.txt'
    rename { String filename ->
        filename.replace('.txt', '_processed.txt')
    }
    doLast {
        println "已处理 ${inputs.files.size()} 个文件"
    }
}</code></pre>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale">
                    <div class="bg-purple-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold">Task依赖控制</h3>
                    </div>
                    <div class="p-6">
                        <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>task deployLocal {
    dependsOn build
    finalizedBy cleanCache
    mustRunAfter test
    
    doLast {
        println "部署到本地环境完成"
    }
}</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale mb-8">
                <div class="bg-purple-600 text-white px-6 py-4">
                    <h3 class="text-xl font-semibold">增量构建示例</h3>
                </div>
                <div class="p-6">
                    <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>task generateReports {
    inputs.dir 'src/data'
    outputs.dir 'build/reports'
    
    doLast {
        // 仅当输入文件变化时执行
        println "生成分析报告..."
    }
}</code></pre>
                    <div class="mt-4 p-4 bg-blue-50 rounded-lg border border-blue-100">
                        <div class="flex items-start">
                            <i class="fas fa-lightbulb text-yellow-500 mt-1 mr-2"></i>
                            <div>
                                <h4 class="font-medium text-blue-800">最佳实践</h4>
                                <p class="text-blue-700">通过声明inputs和outputs，Gradle可以跳过没有变化的Task执行，大幅提升构建速度。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="section-divider my-12"></div>
        </section>

        <!-- Multi-module Project Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="bg-green-100 text-green-600 rounded-full w-12 h-12 flex items-center justify-center mr-4">
                    <i class="fas fa-project-diagram text-2xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">3. 多模块项目管理</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale">
                    <div class="bg-green-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold">典型项目结构</h3>
                    </div>
                    <div class="p-6">
                        <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>project/
├── settings.gradle
├── build.gradle
├── core/
│   └── build.gradle
├── api/
│   └── build.gradle
└── common/
    └── build.gradle</code></pre>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale">
                    <div class="bg-green-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold">settings.gradle配置</h3>
                    </div>
                    <div class="p-6">
                        <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>rootProject.name = 'enterprise-app'

include 'core:data'
include 'core:service'
include 'web:admin'
include 'web:portal'</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale mb-8">
                <div class="bg-green-600 text-white px-6 py-4">
                    <h3 class="text-xl font-semibold">公共配置提取</h3>
                </div>
                <div class="p-6">
                    <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>// 根build.gradle
subprojects {
    apply plugin: 'java'
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        testImplementation 'junit:junit:4.13.2'
    }
    
    java {
        toolchain {
            languageVersion = JavaLanguageVersion.of(17)
        }
    }
}</code></pre>
                </div>
            </div>
            
            <div class="section-divider my-12"></div>
        </section>

        <!-- Plugin System Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="bg-yellow-100 text-yellow-600 rounded-full w-12 h-12 flex items-center justify-center mr-4">
                    <i class="fas fa-puzzle-piece text-2xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">4. 插件系统</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale">
                    <div class="bg-yellow-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold">官方插件应用</h3>
                    </div>
                    <div class="p-6">
                        <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>plugins {
    id 'org.springframework.boot' version '2.7.0'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'com.github.johnrengelman.shadow' version '7.1.2' // 社区插件
}</code></pre>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale">
                    <div class="bg-yellow-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold">自定义脚本插件</h3>
                    </div>
                    <div class="p-6">
                        <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>// gradle/quality.gradle
task checkCodeStyle {
    // 代码规范检查逻辑
}

// build.gradle
apply from: 'gradle/quality.gradle'</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="section-divider my-12"></div>
        </section>

        <!-- Performance Optimization Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="bg-red-100 text-red-600 rounded-full w-12 h-12 flex items-center justify-center mr-4">
                    <i class="fas fa-tachometer-alt text-2xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">5. 构建性能优化</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale mb-8">
                <div class="bg-red-600 text-white px-6 py-4">
                    <h3 class="text-xl font-semibold">关键配置项</h3>
                </div>
                <div class="p-6">
                    <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>// gradle.properties
org.gradle.parallel=true     // 并行构建
org.gradle.caching=true       // 启用缓存
org.gradle.daemon=true        // 守护进程
org.gradle.jvmargs=-Xmx4g     // 内存分配</code></pre>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-8">
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale">
                    <div class="bg-red-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold">构建扫描分析</h3>
                    </div>
                    <div class="p-6">
                        <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto"><code>./gradlew build --scan</code></pre>
                        <div class="mt-4 p-4 bg-blue-50 rounded-lg border border-blue-100">
                            <div class="flex items-start">
                                <i class="fas fa-info-circle text-blue-500 mt-1 mr-2"></i>
                                <div>
                                    <p class="text-blue-700">执行此命令后，Gradle会生成详细的构建分析报告，帮助识别性能瓶颈。</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden hover-scale">
                    <div class="bg-red-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold">性能优化策略</h3>
                    </div>
                    <div class="p-6">
                        <ul class="space-y-3">
                            <li class="flex items-start">
                                <i class="fas fa-check text-red-500 mt-1 mr-2"></i>
                                <span>避免在配置阶段执行耗时操作</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-red-500 mt-1 mr-2"></i>
                                <span>使用<code class="bg-gray-100 px-2 py-1 rounded">@Input</code>/<code class="bg-gray-100 px-2 py-1 rounded">@Output</code>注解优化Task</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-red-500 mt-1 mr-2"></i>
                                <span>按需应用插件（apply false + plugins）</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-red-500 mt-1 mr-2"></i>
                                <span>使用构建缓存目录</span>
                            </li>
                        </ul>
                        <pre class="code-block text-gray-100 p-4 rounded-lg overflow-x-auto mt-4"><code>buildCache {
    local {
        directory = new File(rootDir, 'build-cache')
    }
}</code></pre>
                    </div>
                </div>
            </div>
            
            <!-- Mermaid Diagram -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mt-12">
                <div class="bg-indigo-600 text-white px-6 py-4">
                    <h3 class="text-xl font-semibold">Gradle构建生命周期</h3>
                </div>
                <div class="p-6">
                    <div class="mermaid">
                        graph TD
                            A[初始化] --> B[配置]
                            B --> C[执行]
                            C --> D[完成]
                            
                            subgraph 初始化阶段
                            A --> A1[评估settings.gradle]
                            A1 --> A2[创建项目层次结构]
                            end
                            
                            subgraph 配置阶段
                            B --> B1[构建任务图]
                            B1 --> B2[执行build.gradle]
                            end
                            
                            subgraph 执行阶段
                            C --> C1[运行任务]
                            C1 --> C2[生成输出]
                            end
                    </div>
                </div>
            </div>
        </section>
    </main>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // Add smooth scrolling for anchor links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```